/**
 * JMPlurk, a Java Mobile client for Plurk
 * Copyright (C) 2009 Petra Barus
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package com.maleskoding.jmplurk.plurkapi;

import org.json.me.JSONException;
import org.json.me.JSONObject;

/**
 *
 * @author Petra Barus
 */
public class Plurk extends JSONObject {

    public static final String FIELD_ID = "id";
    public static final String FIELD_QUALIFIER = "qualifier";
    public static final String FIELD_QUALIFIER_TRANSLATED = "qualifier_translated";
    public static final String FIELD_IS_UNREAD = "is_unread";
    public static final String FIELD_PLURK_TYPE = "plurk_type";
    public static final String FIELD_USER_ID = "user_id";
    public static final String FIELD_OWNER_ID = "owner_id";
    public static final String FIELD_POSTED = "posted";
    public static final String FIELD_NO_COMMENTS = "no_comments";
    public static final String FIELD_CONTENT = "content";
    public static final String FIELD_CONTENT_RAW = "content_raw";
    public static final String FIELD_RESPONSE_COUNT = "response_count";
    public static final String FIELD_RESPONSES_SEEN = "responses_seen";
    //

    public Plurk(String jsonstring) throws JSONException {
        super(jsonstring);
    }

    public Plurk(JSONObject jsonobject) throws JSONException {
        super(jsonobject.toString());
    }

    public String getValue(String field) {
        try {
            return getString(field);
        } catch (JSONException ex) {
            return "";
        }
    }
}
